package org.yuci.concurency.executors;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class LoadBalancerService {
	private static final ScheduledExecutorService executor = Executors
			.newSingleThreadScheduledExecutor();
	private static final long REFRESH_INITIAL_DELAY = 5;
	private static final long REFRESH_INTERVAL = 10;

	public static void main(String[] args) {
		LoadBalancer balancer = new LoadBalancer();
		try {
			executor.scheduleWithFixedDelay(balancer, REFRESH_INITIAL_DELAY,
					REFRESH_INTERVAL, TimeUnit.MINUTES);
		} catch (Exception e) {
			System.out.println("Exception scheduling the load balancer! - " + e);
		}
	}
}
